<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"/>
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib prefix="frame" uri="http://www.framework.com/taglib"%>

<html>
  <head>
        <link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
     	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css"></link>
     	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css"></link>
     	<!-- jqueryUI JS文件的引入 -->
	    <script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
	    <script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
	    <script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
	    <!-- jqueryUI国际化 -->
	    <script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
	    <!-- 开发使用的公用js方法 -->
	    <script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
	    <!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	    <script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
	    <script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
 </head>


</head>
<form id="addprofessorDataForm" method="post">
	<table class="infoTable" style="width:50%">
		<tr>
			<th>原始密码:</th>
			<td><input type="password" name="passWord" class="easyui-validatebox" id="passWord" size="30" data-options="required:true" /></td>
		</tr>
		<tr>
			<th>新密码:</th>
			<td><input type="password" name="newpassWord" id="newpassWord" validType="length[6,32]" class="easyui-validatebox" size="30" required="true" value="" /></td>
		</tr>	
		<tr>
			<th>确认密码：</th>
			<td><input type="password" name="repwd" id="repwd"class="easyui-validatebox" size="30" required="true" validType="equalTo['#newpassWord']" invalidMessage="两次输入密码不匹配" /></td>
		</tr>
		<tr>
			<td colspan="2">
				<center>
					<a id="submit" class="easyui-linkbutton" onclick="editpwd();">提交</a>
				</center>
			</td>
		</tr>

	</table>
</form>

<script type="text/javascript">
$(document).ready(
function() {
	$.extend($.fn.validatebox.defaults.rules, {
		/*必须和某个字段相等*/
		equalTo : {
			validator : function(value, param) {
				return $(param[0]).val() == value;
			},
			message:"error",
	     },
    	});	
	});
	
     function editpwd(){
		$('#addprofessorDataForm').form('submit', {    
		    url:"${ctx}/user-login-sys-new/editpwd",
		    onSubmit: function(){  
		    	if($("#newpassWord").val()!=$("#repwd").val()){
		    		$.messager.alert('提示信息','验证没有通过,不能提交表单!','info');		
		    		return false;
		    	}
		    	if (!$('#addprofessorDataForm').form('validate')) {
					$.messager.alert('提示信息','验证没有通过,不能提交表单!','info');				
					return false; //当表单验证不通过的时候 必须要return false 
		    	}
		    },    
		    success:function(data){ 
		    	if(data=="saveSuccess"){
		    	$.messager.alert('提示信息','密码修改成功!','info',function(){
		    		 window.history.go(-1);  
		    	});
		    	
		    	} 
		    	else if(data=="pswNoRight"){
		        $.messager.alert('提示信息','原始密码错误!','info');  
		         } 
		    	}  
		});  
	}  


</script>